package cn.com.bdqn.dao;

import cn.com.bdqn.entity.SalChance;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SalChanceDao {

    public List<SalChance> queryByLike(SalChance salChance);

    @Delete("delete from sal_chance where chc_id = #{value}")
    public int delByChcId(Long chcId);

    @Insert("insert into sal_chance values\n" +
            "(default,#{chcSource},#{chcCustName},#{chcTitle},#{chcRate},#{chcLinkman},#{chcTel},#{chcDesc},#{chcCreateId},#{chcCreateBy},#{chcCreateDate},NULL,NULL,NULL,1);")
    public int addSalChance(SalChance salChance);

    @Update("update sal_chance set chc_source = #{chcSource},chc_cust_name = #{chcCustName},chc_title = #{chcTitle},chc_rate = #{chcRate},chc_linkman = #{chcLinkman},chc_tel = #{chcTel},chc_desc = #{chcDesc} \n" +
            "where chc_id = #{chcId};")
    public int updateSalChance(SalChance salChance);

    @Update("update sal_chance set chc_due_id = #{chcDueId},chc_due_to = #{chcDueTo},chc_due_date = #{chcDueDate},chc_status = 2\n" +
            "where chc_id = #{chcId};")
    public int assign(SalChance salChance);

    @Select("select * from sal_chance where chc_id = #{chcId};")
    public SalChance queryById(SalChance salChance);

    @Update("update sal_chance set chc_status = '3' where chc_id = #{value};")
    public int devSuccess(Long chcId);

    @Update("update sal_chance set chc_status = '4' where chc_id = #{value};")
    public int devFail(Long chcId);

}
